#ifndef IMAGE_WRAPPER_H_INCLUDED
#define IMAGE_WRAPPER_H_INCLUDED

#include <iostream>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdexcept>
#include "Debug.h"

using namespace std;

/**
 *\brief used to load images
 *
 *Image is loaded on a SDL surface
 *Sprites use whole or part of it
 */

class Image_Wrapper {
public:
    ///the layer on which image will be loaded
    SDL_Surface *image;
    string path;
public:
    /**
     *\brief consturctor
     *\param path of the image to be loaded
     *
     *Loads image on temporary surface, chages its display format
     *Frees temporary surface
     *Sets source colorkey to BLUE
     */
    Image_Wrapper(const string &image_path);

    ///constructs blank image wrapper
    Image_Wrapper();

    ///Returns width of loaded image
    unsigned int get_width();

    ///Returns height of loaded image
    unsigned int get_height();

    string &get_path();

    /**
     *\brief destructor
     *
     *Frees loaded surface
     */
    ~Image_Wrapper();

    SDL_Surface *get_surface();
};

inline unsigned int Image_Wrapper::get_width() {
    return image->w;
}

inline unsigned int Image_Wrapper::get_height() {
    return image->h;
}

inline string &Image_Wrapper::get_path() {
    return path;
}

inline SDL_Surface *Image_Wrapper::get_surface() {
    return image;
}
#endif // IMAGE_WRAPPER_H_INCLUDED
